<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>正则扩展-反向断言</title>
</head>


<body>
  <script>
    //声明字符串
    let str = 'JS5211314你知道嘛555哈哈哈';
    //正向断言
    // const reg = /\d+(?=哈)/;
    // const result = reg.exec(str);

    //反向断言
    const reg = /(?<=嘛)\d+/;
    
    const result = reg.exec(str);

    console.log(result);
  </script>
</body>
</html>